<template>
  <el-menu  class="el-menu-demo" align="left"
    background-color="#545c64"
            text-color="#fff"
            active-text-color="#409eff"
            router
            :default-openeds="['a1','a2']"
  >
<!--    <el-submenu  index="a1" >-->
<!--      <template slot="title">-->
<!--        <span>学生管理</span>-->
<!--      </template>-->
<!--      <el-menu-item index="/manager/stu">学生列表</el-menu-item>-->
<!--      <el-menu-item index="/manager/record">奖惩管理</el-menu-item>-->
<!--    </el-submenu>-->

<!--    <el-submenu  index="a2">-->
<!--      <template slot="title">-->
<!--        <span>用户管理</span>-->
<!--      </template>-->
<!--      <el-menu-item index="/manager/logout">退出系统</el-menu-item>-->
<!--    </el-submenu>-->
    <el-tree :data="menusTree" :props="treeMap"></el-tree>
  </el-menu>
</template>

<script>
export default {
  name: "Aside",
  data(){
    return{
      treeMap:{
        label:'name',
        children:'menuList'
      },
      menusTree:[]
    }
  },
  methods:{
    selectMenus(adminId){
      this.axios({
        method:"get",
        url:"/menu/selectMenus/"+adminId
      }).then(
        (response)=>{
          this.menusTree = response.data;
          alert(this.menusTree[0].name);
        }
      )
    }
  },
  created() {
    alert(sessionStorage.getItem("id"));
    this.selectMenus(sessionStorage.getItem("id"));
  }
}
</script>

<style scoped>

</style>
